package network4;

import java.io.*;
import java.net.Socket;

public class Client {
    public static void main(String[] args) throws IOException {
        //创建客户端Socket对象
        Socket socket = new Socket("192.168.7.28", 1024);
        BufferedReader br = new BufferedReader(new FileReader("C:\\networkTest\\net.txt"));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));

        String line;
        while((line=br.readLine())!=null){
            bw.write(line);
            bw.newLine();
            bw.flush();
        }
        socket.shutdownOutput();
        //接收反馈
        BufferedReader brclient = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        String data = brclient.readLine();
        System.out.println(data);
        //释放资源
        br.close();
        socket.close();
    }
}
